========================================== How to Cause Different Types of Exceptions ========================================== Reset * Power on * Hit reset button **Data Abort** .. code-block:: c int *p = 0; int a = *p; **Prefetch Abort** .. code-block:: c void (*funcPtr)(void); funcPtr = (void(*)(void)) 0x10000000; funcPtr(); **Interrupt** * Configure VIC * Set timer FIQ * Setup interrupt vector to use FIQ **SWI** Call SWI instruction using a assembly function:: swi: SWI 0x12345 MOV pc,lr **Undefined** Call undefined instruction using a assembly function:: undefined: .word 0xE3000000 @ causes an undefined exception MOV pc,lr Calling undefined instruction using an in memory function defined in C: .. code-block:: c // Allocate memory for in memory function struct { unsigned int line1; unsigned int line2; } myFunc; int callUndefinedInstruction(void) { // Fill in assembly for myFunc function myFunc.line1 = 0x12345678; // undefined instruction myFunc.line2 = 0xe1a0f00e; // mov pc, lr (return) // Cast the address of myFunc to function pointer then call it. ((void(*)(void))&myFunc)(); } .. Warning:: There is a bug in this code. Can you find it? Hint it has to with the ARM architecture.